\defmodule{AntitheticPointSet}

This container class provides antithetic points.
That is, $1 - u_{i,j}$ is returned in place of coordinate $u_{i,j}$.
To generate regular and antithetic variates with a point
set \texttt{p}, e.g., for variance reduction, one can define an
\class{AntitheticPointSet} object \texttt{pa} that contains \texttt{p},
and then generate the regular variates with \texttt{p} and the
antithetic variates with \texttt{pa}.


\hpierre{Perhaps we should have a container of a stream rather
        than a container of a point set.}

\bigskip\hrule\bigskip

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{code}
\begin{hide}
/*
 * Class:        AntitheticPointSet
 * Description:  
 * Environment:  Java
 * Software:     SSJ 
 * Copyright (C) 2001  Pierre L'Ecuyer and Universite de Montreal
 * Organization: DIRO, Universite de Montreal
 * @author       
 * @since

 * SSJ is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License (GPL) as published by the
 * Free Software Foundation, either version 3 of the License, or
 * any later version.

 * SSJ is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * A copy of the GNU General Public License is available at
   <a href="http://www.gnu.org/licenses">GPL licence site</a>.
 */
\end{hide}
package umontreal.iro.lecuyer.hups;\begin{hide}

import umontreal.iro.lecuyer.util.PrintfFormat;
\end{hide}

public class AntitheticPointSet extends ContainerPointSet \begin{hide} {
\end{hide}
\end{code}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection*{Constructor}
\begin{code}

   public AntitheticPointSet (PointSet P) \begin{hide} {
      init (P);
   }\end{hide}
\end{code}
 \begin{tabb}
   Constructs an antithetic point set from the given point set \texttt{P}.
 \end{tabb}
\begin{htmlonly}
   \param{P}{point set for which we want antithetic version}
\end{htmlonly}
\begin{code}
\begin{hide}

   public double getCoordinate (int i, int j) {
      return 1.0 - P.getCoordinate (i, j);
   }

   public PointSetIterator iterator(){
      return new AntitheticPointSetIterator();
   }

   public String toString() {
      return "Antithetic point set of: {" + PrintfFormat.NEWLINE +
              P.toString() + PrintfFormat.NEWLINE + "}";
   }


   // ***************************************************************

   protected class AntitheticPointSetIterator
                   extends ContainerPointSetIterator {

      public double nextCoordinate() {
         return 1.0 - innerIterator.nextCoordinate();
      }

      public double nextDouble() {
         return 1.0 - innerIterator.nextCoordinate();
      }

      public void nextCoordinates (double p[], int d)  {
         innerIterator.nextCoordinates (p, d);
         for (int j = 0; j < d; j++)
            p[j] = 1.0 - p[j];
      }

      public int nextPoint (double p[], int d)  {
         innerIterator.nextPoint (p, d);
         for (int j = 0; j < d; j++)
            p[j] = 1.0 - p[j];
         return getCurPointIndex();
      }

   }
}\end{hide}
\end{code}
